{% extends 'base.html' %}

{% load highlight %}


{% block content %}
<div class="content-wrap">

{% for blog in page.object_list %}

    <div>
        <a href="{% url 'blog_id' blog.object.id %}">
            <h3>{{ forloop.counter }}、{% highlight blog.object.title with query %}</h3>
        </a>

        <div style="word-wrap: break-word">
            {% highlight blog.object.content with query %}
        </div>


        {% if forloop.counter == page.object_list|length %}
            {% else %}
            <hr>
        {% endif %}
    </div>
{% empty %}
    <div class="no-post">没有搜索到相关内容，请重新搜索</div>
{% endfor %}



          <!--分页展示-->
<nav class="pagination">
    <div class="pageturn">
        <ul class="pagelist">

        {% if page.has_previous %}
            <li class="long"><a href="?q={{ query }}&amp;page={{ page.previous_page_number }}">上一页</a></li>
        {% endif %}

         {% for index in page.pages %}
            {% if index %}
                {% ifequal index page.number %}
                    <li class="active"><a href="?q={{ query }}&amp;page={{ index }}">{{ index }}</a></li>
                {% else %}
                     <li><a href="?q={{ query }}&amp;page={{ index }}" class="page">{{ index }}</a></li>
                {% endifequal %}
            {% else %}
         <li class="none"><a href="">...</a></li>
        {% endif %}
        {% endfor %}
        {% if page.has_next %}
            <li class="long"><a href="?q={{ query }}&amp;page={{ page.next_page_number }}">下一页</a></li>
        {% endif %}

        </ul>
    </div>
</nav>


</div>
{% endblock %}
